<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>openid.server.server.Server</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="openid-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://openidenabled.com/python-openid/">Python-OpenID</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="openid-module.html">Package&nbsp;openid</a> ::
        <a href="openid.server-module.html">Package&nbsp;server</a> ::
        <a href="openid.server.server-module.html">Module&nbsp;server</a> ::
        Class&nbsp;Server
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="openid.server.server.Server-class.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF CLASS DESCRIPTION =========== -->
<h2 class="class">Type Server</h2>

<pre class="base-tree">
<a href="__builtin__.object-class.html"><code>object</code></a> --+
         |
        <b>Server</b>
</pre><br />

<hr/>

<p>I handle requests for an OpenID server.</p>
<p>Some types of requests (those which are not <code>checkid</code> 
requests) may be handed to my <a 
href="openid.server.server.Server-class.html#handleRequest" 
class="link"><code>handleRequest</code></a> method, and I will take care 
of it and return a response.</p>
<p>For your convenience, I also provide an interface to <a 
href="openid.server.server.Decoder-class.html#decode" 
class="link"><code>Decoder.decode</code></a> and <a 
href="openid.server.server.SigningEncoder-class.html#encode" 
class="link"><code>SigningEncoder.encode</code></a> through my methods <a 
href="openid.server.server.Server-class.html#decodeRequest" 
class="link"><code>decodeRequest</code></a> and <a 
href="openid.server.server.Server-class.html#encodeResponse" 
class="link"><code>encodeResponse</code></a>.</p>
<p>All my state is encapsulated in an <a 
href="openid.store.interface.OpenIDStore-class.html" 
class="link"><code>OpenIDStore</code></a>, which means I'm not generally 
pickleable but I am easy to reconstruct.</p>
Example:
<pre class="literalblock">
   oserver = Server(FileOpenIDStore(data_path), &quot;http://example.com/op&quot;)
   request = oserver.decodeRequest(query)
   if request.mode in ['checkid_immediate', 'checkid_setup']:
       if self.isAuthorized(request.identity, request.trust_root):
           response = request.answer(True)
       elif request.immediate:
           response = request.answer(False)
       else:
           self.showDecidePage(request)
           return
   else:
       response = oserver.handleRequest(request)

   webresponse = oserver.encode(response)
</pre>
<hr/>


<!-- =========== START OF METHOD SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Method Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#__init__" class="summary-sig-name"><code>__init__</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>store</span>,
          <span class=summary-sig-arg>op_endpoint</span>)</span></code>
<br />
A new <a href="openid.server.server.Server-class.html" 
class="link"><code>Server</code></a>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <a href="openid.server.server.OpenIDRequest-class.html" 
        class="link"><code>OpenIDRequest</code></a>
</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#decodeRequest" class="summary-sig-name"><code>decodeRequest</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>query</span>)</span></code>
<br />
Transform query parameters into an <a 
href="openid.server.server.OpenIDRequest-class.html" 
class="link"><code>OpenIDRequest</code></a>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <a href="openid.server.server.WebResponse-class.html" 
        class="link"><code>WebResponse</code></a>
</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#encodeResponse" class="summary-sig-name"><code>encodeResponse</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>response</span>)</span></code>
<br />
Encode a response to a <a 
href="openid.server.server.WebResponse-class.html" 
class="link"><code>WebResponse</code></a>, signing it first if 
appropriate.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#handleRequest" class="summary-sig-name"><code>handleRequest</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>request</span>)</span></code>
<br />
Handle a request.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#openid_associate" class="summary-sig-name"><code>openid_associate</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>request</span>)</span></code>
<br />
Handle and respond to <code>associate</code> requests.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
</font></td>
  <td><code><span class="summary-sig"><a href="openid.server.server.Server-class.html#openid_check_authentication" class="summary-sig-name"><code>openid_check_authentication</code></a>(<span class=summary-sig-arg>self</span>,
          <span class=summary-sig-arg>request</span>)</span></code>
<br />
Handle and respond to <code>check_authentication</code> requests.</td></tr>
  <tr><td colspan="2">
    <b>Inherited from <a href="__builtin__.object-class.html"><code>object</code></a>:</b>
      <a href="__builtin__.object-class.html#__delattr__"><code>__delattr__</code></a>, 
      <a href="__builtin__.object-class.html#__getattribute__"><code>__getattribute__</code></a>, 
      <a href="__builtin__.object-class.html#__hash__"><code>__hash__</code></a>, 
      <a href="__builtin__.object-class.html#__new__"><code>__new__</code></a>, 
      <a href="__builtin__.object-class.html#__reduce__"><code>__reduce__</code></a>, 
      <a href="__builtin__.object-class.html#__reduce_ex__"><code>__reduce_ex__</code></a>, 
      <a href="__builtin__.object-class.html#__repr__"><code>__repr__</code></a>, 
      <a href="__builtin__.object-class.html#__setattr__"><code>__setattr__</code></a>, 
      <a href="__builtin__.object-class.html#__str__"><code>__str__</code></a>
    </td></tr>
</table><br />


<!-- =========== START OF INSTANCE VARIABLE SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Instance Variable Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><a href="openid.server.server.Decoder-class.html" 
          class="link"><code>Decoder</code></a></font></td>
<td><b><a href="openid.server.server.Server-class.html#decoder"><code>decoder</code></a></b>: I'm using this to decode things.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><a href="openid.server.server.Encoder-class.html" 
          class="link"><code>Encoder</code></a></font></td>
<td><b><a href="openid.server.server.Server-class.html#encoder"><code>encoder</code></a></b>: I'm using this to encode things.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><a href="openid.association.SessionNegotiator-class.html" 
          class="link"><code>openid.association.SessionNegotiator</code></a></font></td>
<td><b><a href="openid.server.server.Server-class.html#negotiator"><code>negotiator</code></a></b>: I use this to determine which kinds of associations I can make and 
how.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">str</font></td>
<td><b><a href="openid.server.server.Server-class.html#op_endpoint"><code>op_endpoint</code></a></b>: My URL.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><a href="openid.server.server.Signatory-class.html" 
          class="link"><code>Signatory</code></a></font></td>
<td><b><a href="openid.server.server.Server-class.html#signatory"><code>signatory</code></a></b>: I'm using this for associate requests and to sign things.</td></tr>
</table><br />


<!-- =========== START OF CLASS VARIABLE SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Class Variable Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>type</code></font></td>
  <td><a name="decoderClass"></a><b><code>decoderClass</code></b> = <a href="openid.server.server.Decoder-class.html"><code>openid.server.server.Decoder</code></a></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>type</code></font></td>
  <td><a name="encoderClass"></a><b><code>encoderClass</code></b> = <a href="openid.server.server.SigningEncoder-class.html"><code>openid.server.server.SigningEncoder</code></a></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>type</code></font></td>
  <td><a name="signatoryClass"></a><b><code>signatoryClass</code></b> = <a href="openid.server.server.Signatory-class.html"><code>openid.server.server.Signatory</code></a></td></tr>
</table><br />


<!-- =========== START OF METHOD DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Method Details</th></tr>
</table>

<a name="__init__"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">__init__</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>store</span>,
          <span class=sig-arg>op_endpoint</span>=<span class=sig-default>None</span>)</span>
    <br /><i>(Constructor)</i>
  </h3>
  A new <a href="openid.server.server.Server-class.html" 
  class="link"><code>Server</code></a>.
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>store</b></code> -
         The back-end where my associations are stored.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<a href="openid.store.interface.OpenIDStore-class.html" 
              class="link"><code>openid.store.interface.OpenIDStore</code></a>)</i>
      <dd><code><b>op_endpoint</b></code> -
         My URL, the fully qualified address of this server's endpoint, 
        i.e. <code>http://example.com/server</code>
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=str)</i>
      </dd>
    </dl>
    <dl><dt><b>Overrides:</b></dt>
      <dd><a href="__builtin__.object-class.html#__init__"><code>__builtin__.object.__init__</code></a></dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="decodeRequest"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">decodeRequest</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>query</span>)</span>
  </h3>
  <p>Transform query parameters into an <a 
  href="openid.server.server.OpenIDRequest-class.html" 
  class="link"><code>OpenIDRequest</code></a>.</p>
  If the query does not seem to be an OpenID request at all, I return 
  <code>None</code>.
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>query</b></code> -
         The query parameters as a dictionary with each key mapping to 
        one value.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=dict)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        <a href="openid.server.server.OpenIDRequest-class.html" 
        class="link"><code>OpenIDRequest</code></a>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>ProtocolError</b></code> -
        When the query does not seem to be a valid OpenID request.
    </dl>
<p><b>See Also:</b> <a href="openid.server.server.Decoder-class.html#decode" 
class="link"><code>Decoder.decode</code></a>
</p>

  </dd></dl>
</td></tr></table>

<a name="encodeResponse"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">encodeResponse</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>response</span>)</span>
  </h3>
  Encode a response to a <a 
  href="openid.server.server.WebResponse-class.html" 
  class="link"><code>WebResponse</code></a>, signing it first if 
  appropriate.
  <dl><dt></dt><dd>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        <a href="openid.server.server.WebResponse-class.html" 
        class="link"><code>WebResponse</code></a>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>EncodingError</b></code> -
        When I can't figure out how to encode this message.
      <dd><code><b>AlreadySigned</b></code> -
        When this response is already signed.
    </dl>
<p><b>See Also:</b> <a href="openid.server.server.SigningEncoder-class.html#encode" 
class="link"><code>SigningEncoder.encode</code></a>
</p>

  </dd></dl>
</td></tr></table>

<a name="handleRequest"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">handleRequest</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>request</span>)</span>
  </h3>
  <p>Handle a request.</p>
  Give me a request, I will give you a response. Unless it's a type of 
  request I cannot handle myself, in which case I will raise 
  <code>NotImplementedError</code>. In that case, you can handle it 
  yourself, or add a method to me for handling that request type.
  <dl><dt></dt><dd>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>NotImplementedError</b></code> -
        When I do not have a handler defined for that type of 
        request.
    </dl>
  </dd></dl>
</td></tr></table>

<a name="openid_associate"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">openid_associate</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>request</span>)</span>
  </h3>
  Handle and respond to <code>associate</code> requests.
  <dl><dt></dt><dd>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="openid_check_authentication"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">openid_check_authentication</span>(<span class=sig-arg>self</span>,
          <span class=sig-arg>request</span>)</span>
  </h3>
  Handle and respond to <code>check_authentication</code> 
  requests.
  <dl><dt></dt><dd>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        <a href="openid.server.server.OpenIDResponse-class.html" 
        class="link"><code>OpenIDResponse</code></a>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF INSTANCE VARIABLE DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Instance Variable Details</th></tr>
</table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="decoder"></a>
<h3>decoder</h3>
I'm using this to decode things.
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <a href="openid.server.server.Decoder-class.html" 
          class="link"><code>Decoder</code></a>

      </dd>
    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="encoder"></a>
<h3>encoder</h3>
I'm using this to encode things.
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <a href="openid.server.server.Encoder-class.html" 
          class="link"><code>Encoder</code></a>

      </dd>
    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="negotiator"></a>
<h3>negotiator</h3>
I use this to determine which kinds of associations I can make and 
how.
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <a href="openid.association.SessionNegotiator-class.html" 
          class="link"><code>openid.association.SessionNegotiator</code></a>

      </dd>
    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="op_endpoint"></a>
<h3>op_endpoint</h3>
My URL.
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          str

      </dd>
    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="signatory"></a>
<h3>signatory</h3>
I'm using this for associate requests and to sign things.
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <a href="openid.server.server.Signatory-class.html" 
          class="link"><code>Signatory</code></a>

      </dd>
    </dl>
  </dd>
</dl></td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="openid-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://openidenabled.com/python-openid/">Python-OpenID</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on Fri Dec 14 16:10:52 2007</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>
